package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.mapper.LogMapper;
import com.xxx.modules.entity.Log;
import com.xxx.modules.service.LogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * log
 *
 * @author 北易航
 * @since 1.0.0 2022-12-28
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements LogService {

    @Autowired
    private LogMapper logMapper;


    @Override
    public PageInfo<Log> selectLogInfo(Log log, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Log> data = logMapper.selectListInfo(log);
        return new PageInfo<>(data);
    }

    @Override
    public void saveLogInfo(Log log) {
        log.setCreateTime(TimeUtil.getCurrentTime());
        logMapper.insert(log);
    }

    @Override
    public void updateLogInfo(Log log) {
        logMapper.updateById(log);
    }

    @Override
    public void delLogInfo(Integer id) {
        logMapper.deleteById(id);
    }

    @Override
    public void delBatchLogInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        logMapper.deleteBatchIds(list);
    }


}